var obj = {
  name: 'why',
  age: 18,
  height: 1.88
}

// 对象的解构： {}
var{ name, age, height } = obj
console.log(name, age, height) // 'why' 18 1.88
var{ name, height, age } = obj
console.log(name, age, height) // 'why' 18 1.88
var{ age } = obj
console.log(age) // 18

// 重命名
var { name: newName } = obj
console.log(newName) // 'why'

// 默认值
var { address: newAddress = '广州市' } = obj
console.log(newAddress) // '广州市'

var { sno = 12 } = obj
console.log(sno) // 12

function foo ({name, age}) {
  console.log(name, age) // 'why' 18
}

foo(obj)